package com.wisdomparking.task;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.wisdomparking.bean.Rawdata;
import com.wisdomparking.service.ParkingService;
import com.wisdomparking.service.RawdataService;
import com.wisdomparking.tools.SpringContextUtils;
import com.wisdomparking.tools.ToolService;
import com.wisdomparking.tools.ToolValid;

public class RawDataMonitor {
	
	private static ParkingService parkingService = (ParkingService)SpringContextUtils.getBeanByClass(ParkingService.class);
	private static RawdataService rawdataService = (RawdataService)SpringContextUtils.getBeanByClass(RawdataService.class);
	
	public void dataListen() {
		Map<String, Object> map = new HashMap<>();
		map.put("putInStorageMark", 0);
		List<Rawdata> rawDataList = rawdataService.getRawdataList(map);
		if(ToolValid.isNotEmpty(rawDataList)){
			for(Rawdata rawData: rawDataList){
				
				ToolService.dataStorage(rawdataService, parkingService, rawData.getIdentification());
			}
			
			System.out.println("KO");
			
		}
	}
	
}
